package com.rom.ratethehell;

import com.rom.ratethehell.rate.custom_views.OnEnterListener;
import com.rom.ratethehell.rate.custom_views.SearchView;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;


public class MainActivity extends Activity {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);
		Button rate = (Button) findViewById(R.id.rate_button);
		rate.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				startActivity(new Intent(MainActivity.this,RateActivity.class));
				
			}
		});
		Button profile = (Button) findViewById(R.id.profile_button);
		profile.setOnClickListener(new OnClickListener() {
			
			@Override
			public void onClick(View v) {
				Intent intent = new Intent(MainActivity.this,ProfileActivity.class);
				intent.putExtra(ProfileActivity.KEY_PROFILE_TO_SHOW,Global.userName);
				startActivity(intent);
				
			}
		});
		SearchView serachView = (SearchView) findViewById(R.id.searchView); 
		serachView.setOnEnterListener(new OnEnterListener() {

			@Override
			public void onEnter(String input) {
				Intent intent = new Intent(MainActivity.this,ProfileActivity.class);
				intent.putExtra(ProfileActivity.KEY_PROFILE_TO_SHOW,input);
				startActivity(intent);
			}
		});
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

}
